#include<iostream>
#include<unistd.h>
#include <sys/types.h>
#include<string>
using namespace std;

int main()
{
    pid_t id = fork();
    while(true)
    {
        if(id == 0)
        {
            cout<<"我是子进程"<<getpid()<<endl;
            sleep(3);
        }
        else
        {
            cout<<"我是父进程"<<getpid()<<endl;
            sleep(3);
        }
    }
    return 0;
}


